home *** CD-ROM | disk | FTP | other *** search
/ Cracking 1 / Cracking I..iso / Tools / Ostatní / aPLib v0.26b / examples / tmt / aplibu.pas next >
Encoding:
Pascal/Delphi Source File  |  2001-12-15  |  2.5 KB  |  116 lines

  1. unit aplibu;
  2.  
  3. (*
  4.  * aPLib compression library  -  the smaller the better :)
  5.  *
  6.  * TMT Pascal interface to aPLib Delphi objects
  7.  *
  8.  * Copyright (c) 1998-2000 by Joergen Ibsen / Jibz
  9.  * All Rights Reserved
  10.  *
  11.  * -> VPascal by Veit Kannegieser, 23.09.1998
  12.  * -> TMT Pascal by Oleg Prokhorov
  13.  *)
  14.  
  15. interface
  16.  
  17. const
  18.   aP_pack_continue=1;
  19.   aP_pack_break   =0;
  20.  
  21. type
  22.   workmem_type=array[0..640*1024-1] of byte;
  23.  
  24. (* if you want abort compression with Esc uncomment following line *)
  25. (*uses crt; *)
  26.  
  27. function aP_pack(var quelle;
  28.                   var ziel;
  29.                   laenge:longint;
  30.                   var workmem:workmem_type;
  31.                   status:pointer):longint;
  32.  
  33. function aP_depack_asm(var quelle,ziel):longint;
  34.  
  35. function aP_depack_asm_fast(var quelle,ziel):longint;
  36.  
  37. function cb0:longint;
  38. function cb1:longint;
  39.  
  40. implementation
  41.  
  42. function _aP_pack:longint;external;
  43.  
  44. function _aP_workmem_size:longint;external;
  45.  
  46. function _aP_depack_asm:longint;external;
  47.  
  48. function _aP_depack_asm_fast:longint;external;
  49.  
  50. (*$l ..\..\lib\delphi\depack.obj   *)
  51. (*$l ..\..\lib\delphi\depackf.obj  *)
  52. (*$l ..\..\lib\delphi\aplib.obj    *)
  53.  
  54. function aP_pack(var quelle;
  55.                   var ziel;
  56.                   laenge:longint;
  57.                   var workmem:workmem_type;
  58.                   status:pointer):longint;assembler;
  59.   asm
  60.       push status
  61.        push workmem
  62.         push laenge
  63.          push ziel
  64.           push quelle
  65.            call _aP_pack
  66.   end;
  67.  
  68. function aP_workmem_size(laenge:longint):longint;assembler;
  69.   asm
  70.      push laenge
  71.       call _aP_workmem_size
  72.   end;
  73.  
  74. function aP_depack_asm(var quelle,ziel):longint;assembler;
  75.   asm
  76.      push ziel
  77.       push quelle
  78.        call _aP_depack_asm
  79.   end;
  80.  
  81. function aP_depack_asm_fast(var quelle,ziel):longint;assembler;
  82.   asm
  83.      push ziel
  84.       push quelle
  85.        call _aP_depack_asm_fast
  86.   end;
  87.  
  88. (* callback samples for _aP_pack *)
  89.  
  90. function cb0:longint;assembler;
  91.   asm
  92.     mov eax,aP_pack_continue
  93.   end;
  94.  
  95. function cb1_(w1,w2:longint):longint;
  96.   begin
  97.     write(w1:8,w2:8,^m);
  98.     cb1_:=aP_pack_continue;
  99.     (* if you want abort compression with Esc uncomment following line *)
  100.     (*if keypressed then
  101.       if readkey=#27 then
  102.         cb1_:=aP_pack_break; *)
  103.   end;
  104.  
  105. function cb1:longint;assembler;
  106.   asm
  107.     pushad
  108.       push dword [ebp+08h]
  109.         push dword [ ebp+0Ch]
  110.           call cb1_
  111.       mov [esp+1ch],eax (* POPAD restores EAX *)
  112.     popad
  113.   end;
  114.  
  115. end.
  116.